package praktikumid.w07.p4;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class FrameExample extends JFrame {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		JFrame frame = new FrameExample();
		frame.setTitle("Example project title");
		frame.setVisible(true);
		frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
		frame.setLocation(300, 300);
		frame.setSize(400, 400);
		
		JPanel leftPanel = new JPanel();
		leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));
		leftPanel.setBackground(new Color(0, 100, 0));
		
		leftPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		
		frame.getContentPane().add(leftPanel, BorderLayout.WEST);
		
		JButton jbtn = new JButton("Button name");
		jbtn.setFont(new Font("Arial", Font.BOLD, 18));
		leftPanel.add(jbtn);
		
		leftPanel.add(Box.createRigidArea(new Dimension(20, 20)));
		
		leftPanel.add(new JButton("Second button"));
		
		JPanel rightPanel = new JPanel();
		rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
		rightPanel.setBackground(new Color(255, 255, 255));
		
		rightPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		
		frame.getContentPane().add(rightPanel, BorderLayout.SOUTH);
		
		JLabel label1 = new JLabel("tekst tekst tekst tekst tekst tekst");
		label1.setFont(new Font("Arial", Font.BOLD, 48));
		rightPanel.add(label1);
		
		frame.pack();
		
		frame.repaint(); // in this specific case nothing happens!
	}

}
